= api_form_for @search_invoices, :url => invoice_path(:search_invoices) do |f|

  .row
    .span5
      %legend Search invoices request
      = f.input :merchantEmail
      = f.fields_for :parameters do |p|
        = p.input :email
        = p.input :recipientName
        = p.input :businessName
        = p.input :invoiceNumber
        = p.input :currencyCode
        = p.input :memo
        = p.input :origin
        = p.input :lowerAmount
        = p.input :upperAmount
    .span5
      %legend -
      = f.input :page
      = f.input :pageSize
      = f.fields_for :parameters do |p|
        = p.input :status
        = render "date_range", :f => p, :name => :invoiceDate
        = render "date_range", :f => p, :name => :dueDate
        = render "date_range", :f => p, :name => :paymentDate
        = render "date_range", :f => p, :name => :creationDate


  .form-actions
    = f.submit "Submit", :class => "btn btn-primary", :data => { :disable_with => "Processing.." }

- if @search_invoices_response
  = render 'api_response', :request => @search_invoices, :response => @search_invoices_response
